package com.tc.dispatch.rwservice.ejb;

import java.util.*;
import javax.ejb.*;

import com.tc.dispatch.gsalgorithm.rwconf.*;
import com.tc.dispatch.rwservice.dao.*;
import com.tc.dispatch.rwservice.exception.*;
import com.tc.dispatch.rwservice.model.*;
import com.tc.dispatch.rwservice.util.*;
import com.tc.dispatch.rwservice.exception.RWException;
import java.sql.*;

public class RWServiceBean
    implements SessionBean {
  SessionContext sessionContext;
  com.tc.dispatch.rwservice.dao.RWWHDAO rwwhdao;
  PlanDAO plandao;
  com.tc.dispatch.rwservice.dao.LoadDAO loaddao;
  public void ejbCreate() throws CreateException {
    /**@todo Complete this method*/
    rwwhdao = DAOFactory.getRWWHDAO();
    plandao = DAOFactory.getPlanDAO();
    loaddao=DAOFactory.getLoadDAO();
  }

  public void ejbRemove() {
    /**@todo Complete this method*/
  }

  public void ejbActivate() {
    /**@todo Complete this method*/
  }

  public void ejbPassivate() {
    /**@todo Complete this method*/
  }

  public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
  }


  // public List findWareHouse(String whereString) throws RWException {
  /**@todo Complete this method*/
  //  return rwwhdao.findWareHouse(whereString);
  // }

  public List findWHByCP(String ssign, String spec, String plate, float qty) throws RWException {
    /**@todo Complete this method*/
    return rwwhdao.findChengPin(ssign, spec, plate, qty);
  }

  public List findWHByBP(String ssign, String spec, float qty) throws RWException {
    /**@todo Complete this method*/
    return rwwhdao.findBoPian(ssign, spec, qty);
  }

  public List findWHByYZ(String ssign, String spec, float qty) throws RWException {
    /**@todo Complete this method*/
    return rwwhdao.findYuanZhu(ssign, spec, qty);
  }



  public List showPlan(String facname) throws RWException {
    /**@todo Complete this method*/
    return plandao.showPlan(facname);
  }






  public HashMap showplanAll() throws RWException {
    /**@todo Complete this method*/
    return plandao.showPlanAll();
  }

  public float getLoadByNow(int fac, java.util.Date now) throws RWException {
    /**@todo Complete this method*/
    return loaddao.getLoadByFac(fac,now);
  }



  public List getUndoPlan() throws RWException {
    /**@todo Complete this method*/
    return plandao.getUndoPlan();
  }

  public Plan findPlan(String salesid, String plannum) throws RWException {
    /**@todo Complete this method*/
    return plandao.findPlan(salesid, plannum);
  }




  public void refreshWh() throws RWException {
    /**@todo Complete this method*/
    //rwwhdao.refreshWH();
   // WHConfig.setModifyDate(Calendar.getInstance().getTime());
  }

  public java.util.Date getRefreshTime() {
    /**@todo Complete this method*/
    return WHConfig.getModifyDate();
  }
  public int createLoad(Load load) throws RWException {
    /**@todo Complete this method*/
    return loaddao.createLoad(load);
  }
  public void updateLoad(Load load) throws RWException {
    /**@todo Complete this method*/
    loaddao.updateLoad(load);
  }
  public void removeLoad(int fac) throws RWException {
    /**@todo Complete this method*/
    loaddao.removeLoad(fac);
  }
  public Load getLoad(int fac) throws RWException {
    /**@todo Complete this method*/
    return loaddao.getLoad(fac);
  }
  public List findLoad(String wherestr) throws RWException {
    /**@todo Complete this method*/
    return loaddao.findLoad(wherestr);
  }
  public void initLoad() throws RWException {
    /**@todo Complete this method*/
    loaddao.initLoad();
  }


  public void addData(String whid, String type, String ssign, String spec, String plate, float qty) throws RWException {
    /**@todo Complete this method*/
    rwwhdao.insertWh(whid,type,ssign,spec,plate,qty);

  }
  public List findERPTask(String whereStr) throws RWException {
    /**@todo Complete this method*/
    return plandao.findERPTask(whereStr);
  }
  public List findERPTaskByPages(int start, int limit) throws RWException {
    /**@todo Complete this method*/
    return plandao.findERPTaskByPages(start,limit);
  }
  public int getERPTaskTotalNum(String whereStr) throws RWException {
    /**@todo Complete this method*/

    return plandao.getTotalNums(whereStr);
  }
  public List findERPWH(String whereStr) throws RWException {
    /**@todo Complete this method*/
    return rwwhdao.findERPWH(whereStr);
  }
  public List findERPFactory(String whereStr) throws RWException {
    /**@todo Complete this method*/
    return loaddao.findERPFactory(whereStr);
  }
  public void createERPPlanCtrl(ERPPlanCtrl erp) throws RWException {
    /**@todo Complete this method*/
    plandao.createERPPlanCtrl(erp);
  }
  public List findERPTaskFromPlan(String whereStr)  throws RWException {
    /**@todo Complete this method*/
    return plandao.findERPTaskFromPlan(whereStr);
  }

}